<?php
/*
 * Created on 23 mars 07
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 class Customer extends Appmodel {
 	var $name = 'Customer';
 	var $validate = array(
 					'username' => VALID_NOT_EMPTY
 					);
 					
 	var $belongsTo = array('User' => array(
 							'className' => 'User',
 							'conditions' => '',
 							'order' => '',
 							'foreignKey' => 'user_id'
 							)
 						);
 						
 	var $hasMany = array('Bill' => array(
 							'className' => 'Bill',
 							'conditions' => '',
 							'order' => '',
 							'foreignKey' => 'customer_id'
 							)
 						);
 	
 	
 	//http://code.google.com/p/caddy-x6tm/issues/detail?id=5
 	//to verify
 	/*var $hasAndBelongsToMany = array('Product' => array(
 										'className' => 'Product'
 										)
 								);*/
 	
 	//needed in users controller					
 	function editCustomer($customer){
 			$this->getID();
 			if($this->save($customer)){
 				return true;
 			}else{
 				return false;
 			}
 	}
 	
 }
?>
